<HTML
><HEAD
><TITLE
>GrGetNextEvent()</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.61
"><LINK
REL="HOME"
TITLE="Nano-X Library API"
HREF="index.html"><LINK
REL="UP"
TITLE="Nano-X Function Reference"
HREF="ch2.html"><LINK
REL="PREVIOUS"
TITLE="GrGetImageInfo()"
HREF="nxapi_GrGetImageInfo.html"><LINK
REL="NEXT"
TITLE="GrGetNextEventTimeout()"
HREF="nxapi_GrGetNextEventTimeout.html"></HEAD
><BODY
CLASS="REFENTRY"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Nano-X Library API</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="nxapi_GrGetImageInfo.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="nxapi_GrGetNextEventTimeout.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="NXAPI.GRGETNEXTEVENT"
><TT
CLASS="FUNCTION"
>GrGetNextEvent()</TT
></A
></H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN3406"
></A
><H2
>Name</H2
><TT
CLASS="FUNCTION"
>GrGetNextEvent()</TT
>&nbsp;--&nbsp;Get an event from the queue</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN3410"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN3411"
></A
><P
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>  void               <B
CLASS="FSFUNC"
>  GrGetNextEvent        </B
></CODE
>( GR_EVENT *         <VAR
CLASS="PDPARAM"
> ep                    </VAR
>);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3417"
></A
><H2
>Description</H2
><P
>    This function retrieves the next nano-X event from the event
    queue and returns the event in the caller supplied
    <SPAN
CLASS="STRUCTNAME"
>GR_EVENT</SPAN
> structure. If the event queue
    is empty, the function will block until another event occurs.
    </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3421"
></A
><H2
>Parameters</H2
><DIV
CLASS="INFORMALTABLE"
><A
NAME="AEN3423"
></A
><P
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
WIDTH="25%"
ALIGN="LEFT"
VALIGN="TOP"
>Type</TH
><TH
WIDTH="25%"
ALIGN="LEFT"
VALIGN="TOP"
>Name</TH
><TH
WIDTH="50%"
ALIGN="LEFT"
VALIGN="TOP"
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
WIDTH="25%"
ALIGN="LEFT"
VALIGN="TOP"
><A
HREF="nxstruct_GR_EVENT.html"
>        <SPAN
CLASS="STRUCTNAME"
>GR_EVENT*</SPAN
></A
></TD
><TD
WIDTH="25%"
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="PARAMETER"
><I
>ep</I
></TT
></TD
><TD
WIDTH="50%"
ALIGN="LEFT"
VALIGN="TOP"
>Pointer to the caller supplied structure to receive the
        next event from the event queue. </TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3441"
></A
><H2
>Example</H2
><P
>    The following example shows a typical event loop. The first line
    of the infinite while loop will suspend the client application
    until an event is available in the event queue. Then the example
    switches on the event type calling the appropriate application
    function to process the event.
    </P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN3444"
></A
><P
><B
>Example 2-1. Using <TT
CLASS="FUNCTION"
>GrGetNextEvent()</TT
></B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
> 
void typical_event_loop (void)
{
    GR_EVENT  event;

    while (1)
    {
        GrGetNextEvent (&#38;event);
        switch (event.type)
        {
        case GR_EVENT_TYPE_EXPOSURE:
            process_exposure_event ((GR_EVENT_EXPOSURE*) event);
            break;

        case GR_EVENT_TYPE_BUTTON_DOWN:
            process_button_event ((GR_EVENT_BUTTON*) event);
            break;

        case GR_EVENT_TYPE_KEY_DOWN:
        case GR_EVENT_TYPE_KEY_UP:
            process_key_event ((GR_EVENT_KEYSTROKE*) event);
            break;

        case GR_EVENT_TYPE_SCREENSAVER:
            process_screensaver_event ((GR_EVENT_SCREENSAVER*) event);
            break;

        case GR_EVENT_TYPE_CLOSE_REQ:
            GrClose();
            exit (0);
        }
    }
}</PRE
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3448"
></A
><H2
>See Also</H2
><P
>      <A
HREF="nxapi_GrSelectEvents.html"
>            <TT
CLASS="FUNCTION"
>GrSelectEvents()</TT
></A
>,
      <A
HREF="nxapi_GrGetNextEventTimeout.html"
>            <TT
CLASS="FUNCTION"
>GrGetNextEventTimeout()</TT
></A
>,
      <A
HREF="nxapi_GrCheckNextEvent.html"
>            <TT
CLASS="FUNCTION"
>GrCheckNextEvent()</TT
></A
>,
      <A
HREF="nxapi_GrPeekEvent.html"
>            <TT
CLASS="FUNCTION"
>GrPeekEvent()</TT
></A
>, 
      <A
HREF="nxapi_GrMainLoop.html"
>            <TT
CLASS="FUNCTION"
>GrMainLoop()</TT
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="nxapi_GrGetImageInfo.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="nxapi_GrGetNextEventTimeout.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><TT
CLASS="FUNCTION"
>GrGetImageInfo()</TT
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ch2.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><TT
CLASS="FUNCTION"
>GrGetNextEventTimeout()</TT
></TD
></TR
></TABLE
></DIV
></BODY
></HTML
>